<template>
  <c-form-dialog
    ref="form"
    :form-data="formData"
    :form-items="formItems"
    :table-id="tableId"
    :table-name="tableName"
    :visible.sync="innerVisible"
    :before-save="handleBeforeSave"
    @dismiss="handleDismiss"
    @success="handleSuccess"
    title="催收确认"
  ></c-form-dialog>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
  components: {},
  props: {
    visible: Boolean,
    tableId: String,
    formData: {
      type: Object,
      default() {
        return {}
      },
    },
  },
  data() {
    return {
      innerVisible: false,

      formItems: [
        {
          tag: 'el-switch',
          itemAttrs: {
            label: '催收确认',
            rules: [{ required: true, message: '请选择催收确认', trigger: 'change' }],
          },
          attrs: {
            key: 'is_notice',
            value: '',
            placeholder: '请选择催收确认',
            activeValue: '1',
            inactiveValue: '0',
          },
        },
        {
          tag: 'textarea',
          itemAttrs: { label: '备注' },
          attrs: {
            key: 'notice_remark',
            value: '',
            placeholder: '请输入备注',
            autosize: { minRows: 3 },
          },
        },
      ],
      tableName: 'datum_repay_list',
    }
  },
  computed: {
    ...mapGetters(['user']),
  },
  watch: {
    visible(val) {
      this.innerVisible = val
    },
  },
  created() {},
  mounted() {},
  methods: {
    handleBeforeSave(model) {
      return model
    },
    handleDismiss() {
      this.innerVisible = false
      this.$emit('update:visible', false)
    },
    handleSuccess() {
      this.$emit('success', false)
      this.handleDismiss()
    },
  },
}
</script>
<style lang="scss" scoped></style>
